-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore(ci): setup automated stainless builds #3557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(ci): setup automated stainless builds #3557
Conversation
|
Just added the |
leseb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that this can only work when NOT submitting a PR from fork given Github security model on passing secrets to workflow.
@dgellow I'm wondering how this is used elsewhere in practice and how other projects overcome that? Thanks!
|
I'm moving this one back to draft until I have a great documented solution to share |
|
Parts 1, 2, 3, and 4 of https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/ are important reading if we need to find a way to pass a secret into something triggered on every pull request. |
|
Thanks @bbrowning. I actually already read those articles, unfortunately there are a few details that are making the mentioned solutions a no-go for this repo. edit: well, not exactly today, my plane internet is spotty |
0dc7d00 to
a0eb949
Compare
|
Currently blocked by stainless-api/upload-openapi-spec-action#133. Once merged I will update the github action SHA and that should be ready. |
df9149c to
cfae411
Compare
|
Some notes that may be of interest that I shared on Discord. The workflow
On security
|
|
@dgellow how could we do a test-run of this? We have a change from @raghotham which updated the types. See #3948 |
|
@ashwinb A test run would require the PR to be first merged, then a PR to be opened or rebased/updated to trigger CI checks. At least for PRs from forks, Github only run workflows if they already exist in the base repo. Edit: actually, given that their PR has already been merged, we would need to open a new one. The workflow I'm adding is triggered on PR events |
70ff07d to
acb82d9
Compare
|
Hmm - the security guidance from stainless-api/upload-openapi-spec-action says, We do not require approval for workflows from fork PRs for every untrusted contributor. We only require approval on the first contribution, I believe? I wouldn't be comfortable merging this, as the usage of |
|
The wording for that section of the README is a bit too strong (I did write it, I will take another pass to clarify the actual risk). I would invite you to review the action implementation, it doesn't execute anything from the repo context, it only reads the spec + config files, pass them to the Stainless API, then interact with GitHub API to add a comment. As mentioned here the use of What would be problematic:
|
|
We discussed this on Discord a bit. I share @bbrowning's concerns -- I have been bit by To summarize, here is what the proposed process for making an API change would be:
Thoughts here @cdoern @mattf @leseb @bbrowning @ehhuang ? |
Yes that's correct. The only role of the OIDC token here is to check the request originates from a repo that has access to the stainless org/project. It's just a more convenient and safer (because short-lived) alternative to adding a Stainless API key to your repo secrets. The only API writes are:
Edit: I forgot to add that as far as I'm aware github OIDC tokens are only used for authentication with external services, they do not provide write permissions to the repo itself! The only risk is regarding Stainless writes, not GitHub writes. |
|
One tiny detail here:
If someone with write access to the repo approves the release PRs in SDK repositories the github app will attempt to merge it, you shouldn't have to run a workflow (but you of course can if you prefer to do it that way). That can be automated easily using the github CLI if you want to do it across all sdk repos |
ashwinb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the token usage
2e765c7 to
3407792
Compare
121f74e to
7469cf8
Compare
7469cf8 to
d6366e0
Compare
The concern (not working from a fork) has been addressed. Security concerns are addressed (the OIDC token is used for identity, the GITHUB_TOKEN is still read-only)
043c3b9 to
39b6b27
Compare
39b6b27 to
006f787
Compare
|
After discussion with @ashwinb in Discord we decided to keep |
ashwinb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright lets land this and see how it works out. thanks a ton for your patience and iteration on it.
What does this PR do?
This pull request adds a new workflow that does 2 things:
Note
No repo secret
STAINLESS_API_KEYis needed, the authentication is done automatically via GitHub OIDC.Test Plan
I tested in my fork: stainless-api#3